All Packages Class Hierarchy This Package Previous Next Index
Class sun.security.x509.AlgorithmId
java.lang.Object
|
+----sun.security.x509.AlgorithmId
- public class AlgorithmId
- extends Object
- implements Serializable
This class identifies algorithms, such as cryptographic transforms, each
of which may be associated with parameters. Instances of this base class
are used when this runtime environment has no special knowledge of the
algorithm type, and may also be used in other cases. Equivalence is
defined according to OID and (where relevant) parameters.
Subclasses may be used, for example when when the algorithm ID has
associated parameters which some code (e.g. code using public keys) needs
to have parsed. Two examples of such algorithms are Diffie-Hellman key
exchange, and the Digital Signature Standard Algorithm (DSS/DSA).
The OID constants defined in this class correspond to some widely
used algorithms, for which conventional string names have been defined.
This class is not a general repository for OIDs, or for such string names.
Note that the mappings between algorithm IDs and algorithm names is
not one-to-one.
-
DH_oid
- Algorithm ID for Diffie Hellman Key agreement, from PKCS #3.
-
DSA_oid
- Algorithm ID for the Digital Signing Algorithm (DSA), from the
NIST Object Implementors' Workshop.
-
MD2_oid
- Algorithm ID for the MD2 Message Digest Algorthm, from RFC 1319.
-
md2WithRSAEncryption_oid
- Identifies a signing algorithm where an MD2 digest is encrypted
using an RSA private key; defined in PKCS #1.
-
MD5_oid
- Algorithm ID for the MD5 Message Digest Algorthm, from RFC 1321.
-
md5WithRSAEncryption_oid
- Identifies a signing algorithm where an MD5 digest is
encrypted using an RSA private key; defined in PKCS #1.
-
params
- Parameters for this algorithm.
-
RSA_oid
- Algorithm ID for RSA keys used for any purpose, as defined in X.509.
-
RSAEncryption_oid
- Algorithm ID for RSA keys used with RSA encryption, as defined
in PKCS #1.
-
SHA_oid
- Algorithm ID for the SHA1 Message Digest Algorithm, from FIPS 180-1.
-
shaWithDSA_oid
- Identifies the FIPS 186 "Digital Signature Standard" (DSS), where a
SHA1 digest is signed using the Digital Signing Algorithm (DSA).
-
AlgorithmId()
- Constructs an algorithm ID which will be initialized
separately, for example by deserialization.
-
AlgorithmId(ObjectIdentifier)
- Constructs a parameterless algorithm ID.
-
decodeParams()
- When redefined by subclassers, this function allows algorithm
parameters to be automatically parsed.
-
emit(DerOutputStream)
- Marshal a DER-encoded "AlgorithmID" sequence on the DER stream.
-
encode()
- Returns the DER-encoded X.509 AlgorithmId as a byte array.
Deprecated.
-
encode(OutputStream)
- Emit DER-encoded X.509 "AlgorithmId" sequence on the output stream.
Deprecated.
-
equals(AlgorithmId)
- Returns true iff the argument indicates the same algorithm
with the same parameters.
-
equals(Object)
- Compares this AlgorithmID to another.
-
equals(ObjectIdentifier)
- Compares two algorithm IDs for equality.
-
get(String)
- Returns one of the algorithm IDs most commonly associated
with this algorithm name.
-
getAlgorithmId(String)
- Returns one of the algorithm IDs most commonly associated
with this algorithm name.
Deprecated.
-
getName()
- Returns a name for the algorithm which may be more intelligible
to humans than the algorithm's OID, but which won't necessarily
be comprehensible on other systems.
-
getOID()
- Returns the ISO OID for this algorithm.
-
paramsToString()
- Provides a human-readable description of the algorithm parameters.
-
parse(DerValue)
- Parse (unmarshal) an ID from a DER sequence input value.
-
toString()
- Returns a string describing the algorithm and its parameters.
params
protected DerValue params
- Parameters for this algorithm. These are stored in unparsed
DER-encoded form; subclasses can be made to automaticaly parse
them so there is fast access to these parameters.
MD2_oid
public static final ObjectIdentifier MD2_oid
- Algorithm ID for the MD2 Message Digest Algorthm, from RFC 1319.
MD5_oid
public static final ObjectIdentifier MD5_oid
- Algorithm ID for the MD5 Message Digest Algorthm, from RFC 1321.
SHA_oid
public static final ObjectIdentifier SHA_oid
- Algorithm ID for the SHA1 Message Digest Algorithm, from FIPS 180-1.
This is sometimes called "SHA", though that is often confusing since
many people refer to FIPS 180 (which has an error) as defining SHA.
DH_oid
public static final ObjectIdentifier DH_oid
- Algorithm ID for Diffie Hellman Key agreement, from PKCS #3.
Parameters include public values P and G, and may optionally specify
the length of the private key X. Alternatively, algorithm parameters
may be derived from another source such as a Certificate Authority's
certificate.
DSA_oid
public static final ObjectIdentifier DSA_oid
- Algorithm ID for the Digital Signing Algorithm (DSA), from the
NIST Object Implementors' Workshop.
Parameters
may include public values P, Q, and G; or these may be derived from
another source such as a Certificate Authority's certificate.
RSA_oid
public static final ObjectIdentifier RSA_oid
- Algorithm ID for RSA keys used for any purpose, as defined in X.509.
The algorithm parameter is a single value, the number of bits in the
public modulus.
RSAEncryption_oid
public static final ObjectIdentifier RSAEncryption_oid
- Algorithm ID for RSA keys used with RSA encryption, as defined
in PKCS #1. There are no parameters associated with this algorithm.
md2WithRSAEncryption_oid
public static final ObjectIdentifier md2WithRSAEncryption_oid
- Identifies a signing algorithm where an MD2 digest is encrypted
using an RSA private key; defined in PKCS #1. Use of this
signing algorithm is discouraged due to MD2 vulnerabilities.
md5WithRSAEncryption_oid
public static final ObjectIdentifier md5WithRSAEncryption_oid
- Identifies a signing algorithm where an MD5 digest is
encrypted using an RSA private key; defined in PKCS #1.
shaWithDSA_oid
public static final ObjectIdentifier shaWithDSA_oid
- Identifies the FIPS 186 "Digital Signature Standard" (DSS), where a
SHA1 digest is signed using the Digital Signing Algorithm (DSA).
AlgorithmId
public AlgorithmId(ObjectIdentifier oid)
- Constructs a parameterless algorithm ID.
- Parameters:
- oid - the identifier for the algorithm
AlgorithmId
public AlgorithmId()
- Constructs an algorithm ID which will be initialized
separately, for example by deserialization.
getAlgorithmId
public static AlgorithmId getAlgorithmId(String algname) throws NoSuchAlgorithmException
- Note: getAlgorithmId() is deprecated.
use the short get form of this method.
- Returns one of the algorithm IDs most commonly associated
with this algorithm name.
- Parameters:
- algname - the name being used
get
public static AlgorithmId get(String algname) throws NoSuchAlgorithmException
- Returns one of the algorithm IDs most commonly associated
with this algorithm name.
- Parameters:
- algname - the name being used
parse
public static AlgorithmId parse(DerValue val) throws IOException
- Parse (unmarshal) an ID from a DER sequence input value. This form
parsing might be used when expanding a value which has already been
partially unmarshaled as a set or sequence member.
- Parameters:
- val - the input value, which contains the algid and, if
there are any parameters, those parameters.
- Returns:
- an ID for the algorithm. If the system is configured
appropriately, this may be an instance of a class
with some kind of special support for this algorithm.
In that case, you may "narrow" the type of the ID.
decodeParams
protected void decodeParams() throws IOException
- When redefined by subclassers, this function allows algorithm
parameters to be automatically parsed. For example, this could
cause encoded DSA algorithm parameters P, Q, and G to be stored
so that both private (X) and public (Y) keys can share them.
emit
public final void emit(DerOutputStream out) throws IOException
- Marshal a DER-encoded "AlgorithmID" sequence on the DER stream.
encode
public final void encode(OutputStream out) throws IOException
- Note: encode() is deprecated.
use the emit method instead
- Emit DER-encoded X.509 "AlgorithmId" sequence on the output stream.
encode
public final byte[] encode() throws IOException
- Note: encode() is deprecated.
use the emit method instead
- Returns the DER-encoded X.509 AlgorithmId as a byte array.
getOID
public final ObjectIdentifier getOID()
- Returns the ISO OID for this algorithm. This is usually converted
to a string and used as part of an algorithm name, for example
"OID.1.3.14.3.2.13" style notation. Use the
getName
call when you do not need to ensure cross-system portability
of algorithm names, or need a user friendly name.
getName
public String getName()
- Returns a name for the algorithm which may be more intelligible
to humans than the algorithm's OID, but which won't necessarily
be comprehensible on other systems. For example, this might
return a name such as "MD5withRSA" for a signature algorithm on
some systems. It also returns names like "OID.1.2.3.4", when
no particular name for the algorithm is known.
toString
public String toString()
- Returns a string describing the algorithm and its parameters.
- Overrides:
- toString in class Object
paramsToString
protected String paramsToString()
- Provides a human-readable description of the algorithm parameters.
This may be redefined by subclasses which parse those parameters.
equals
public boolean equals(AlgorithmId other)
- Returns true iff the argument indicates the same algorithm
with the same parameters.
equals
public boolean equals(Object other)
- Compares this AlgorithmID to another. If algorithm parameters are
available, they are compared. Otherwise, just the object IDs
for the algorithm are compared.
- Parameters:
- other - preferably an AlgorithmId, else an ObjectIdentifier
- Overrides:
- equals in class Object
equals
public final boolean equals(ObjectIdentifier id)
- Compares two algorithm IDs for equality. Returns true iff
they are the same algorithm, ignoring algorithm parameters.
All Packages Class Hierarchy This Package Previous Next Index